package com.sykj.bsc.jhy.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sykj.bsc.jhy.entity.Bis_nurse_bag;
import com.sykj.bsc.jhy.entity.Bis_nurse_project;
import com.sykj.bsc.jhy.service.Bis_nurse_bagService1;
import com.sykj.bsc.jhy.service.Bis_nurse_projectService;
@Controller
@RequestMapping("proltal/jhy")
public class Bis_nurse_bagHandler1 {
	@Autowired
	Bis_nurse_bagService1 service1;
	@Autowired Bis_nurse_projectService impl;
	/**
	 * ��ѯ
	 * @param map
	 * @param bag
	 * @return
	 */
	@RequestMapping("selectBis_nurse_bag1")
	public String selectBis_nurse_bag1(Map<String, Object> map,Bis_nurse_bag bag){
		map.put("bag1List", service1.selectBis_nurse_bag1(bag));
		return "foreground/jhy/Bis_nurse_bagShow1";
	}
	/**
	 * @param map1
	 * @param bag_id
	 * @return
	 */
	@RequestMapping("findBybag_idBis_nurse_bag1/{bag_id}")
	@ResponseBody
	public void findBybag_idBis_nurse_bag1(@PathVariable("bag_id")int bag_id,Map<String, Object> map1,HttpServletResponse res){
		ObjectMapper mapper=new ObjectMapper();
		try {
			String jsonStr=mapper.writeValueAsString(service1.findBybag_idBis_nurse_bag1(bag_id));
		} catch (JsonGenerationException e) {
			e.printStackTrace();
		} catch (JsonMappingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	//前台护理列表
		@RequestMapping("Bis_nurse_projectReception")
		public String Bis_nurse_projectReception(Bis_nurse_project bis_nurse_project,Model model) {
			List<Bis_nurse_project> list = impl.selectBis_nurse_projectReception(bis_nurse_project);
			model.addAttribute("list", list);	
			model.addAttribute("tlist", impl.selectBis_nurse_type());
			return "foreground/jhy/Bis_nurse_projectReception";
		}
		
		//前台护理详情
		
		@RequestMapping("selectByIdproject/{project_id}")
		public String selectByIdproject(@PathVariable("project_id") Integer project_id,Model model) {
			Bis_nurse_project bnp = impl.queryById(project_id);
			model.addAttribute("bnp", bnp);
			return "foreground/jhy/qiantaiproject";
		}
}
